/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-20 14:54:09
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-20 15:43:18
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/utills/color_utils.dart';

class MonthList extends StatelessWidget {
  const MonthList({Key key, this.month, this.onTap}) : super(key: key);
  final int month;
  final ValueChanged<int> onTap;

  @override
  Widget build(BuildContext context) => Container(
        height: 20,
        width: double.infinity,
        child: ListView.builder(
          scrollDirection: Axis.horizontal,
          itemCount: 12,
          physics: BouncingScrollPhysics(),
          itemBuilder: (context, index) => InkWell(
            borderRadius: BorderRadius.circular(30),
            onTap: () => onTap(index),
            child: Container(
              width: 45,
              height: 20,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(30),
                color: month == index ? gColor("#E9FFFA") : Colors.transparent,
              ),
              child: Center(
                child: Text(
                  "${index + 1} 月",
                  style: TextStyle(
                    fontSize: 13,
                    height: 1,
                    color:
                        month == index ? gColor("#08D187") : gColor("#A0A0A0"),
                  ),
                ),
              ),
            ),
          ),
        ),
      );
}
